import {mapActions, mapState} from "vuex"
import headerWrap from "../header.vue"
import noData from "../noMoreData.vue"
import foldWrap from "../fold.vue"
import actionSheet from "../actionSheet.vue"

let baseInfo = {
  init: (v) => {
    return {
      title: "详情信息",
      data: [
        {
          label: "标题",
          type: 1,
          value: "标题"
        },
        {
          label: "事件类型",
          type: 1,
          value: "事件类型"
        },
        {
          label: "事件等级",
          type: 1,
          value: "事件等级"
        },
        {
          label: "发生日期",
          type: 1,
          value: "发生日期"
        },
        {
          label: "报送单位",
          type: 1,
          value: "报送单位"
        },
        {
          label: "填报人",
          type: 1,
          value: "填报人"
        },
      ],
    }
  },
  eventLevelToString(v){
    return ['', '特别重大', '重大', '较大', '一般', '其他'][v];
  }
};

window.adviseTextarea = "";

export default {
  data(){
    return {
      bodyShow: true,
      switch_cs_show: false,
      actionShow: false,
      details: {
        baseInfo: baseInfo.init(),
        advise: [1, 2, 3, 4, 5]
      },
      actionData: [
        {txt: '发起对话', iconClass: "action-icon-chat", value: ""},
        {txt: '拨打电话', iconClass: "action-icon-call", value: ""}
      ],
      advise: ""
    }
  },
  methods: {
    init(){
      this.switchInit();
    },
    btnClick(){

    },
    getAdvice(e){
      adviseTextarea = e.target.value;
    },
    switchInit(){
      if (document.getElementById("mySwitch")) {
        mui('.mui-switch')['switch']();
        document.getElementById("mySwitch").addEventListener("toggle", (event) => {
          if (event.detail.isActive) {
            this.switch_cs_show = true;
          } else {
            this.switch_cs_show = false;
          }
        });
      }
    },
    actionClick(i){
      if (i === 1) {
        vrv.jssdk.callPhone({
          phoneNum: "",
          success: function success(res) {
          }
        });
      } else {
        vrv.jssdk.openChat({
          chatId: "",
          success: function success(res) {
          }
        });
      }
    }
  },
  components: {
    headerWrap,
    noData,
    foldWrap,
    actionSheet,
  },
  mounted(){
    this.init()
  }
}
